# 面向对象，搜索天气预报
from time import sleep

from selenium import webdriver
from selenium.webdriver.common.by import By


class BrowserSearch:
    def __init__(self):
        self.chrome = webdriver.Chrome()

    def quit(self):
        self.chrome.quit()

    def weather_forecast(self):
        self.chrome.get("https://www.sogou.com")
        sleep(2)
        self.chrome.find_element(By.ID, "query").send_keys("天气预报")
        sleep(2)
        self.chrome.find_element(By.ID, "stb").click()
        sleep(5)


if __name__ == '__main__':
    search = BrowserSearch()
    search.weather_forecast()
    search.quit()
